package com.panfeng.xcloud.dashboard;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;

/**
 * springcloud Dashboard 熔断器监控白板
 *
 * @author xiaobo
 * @date 2018-07-08
 */
@SpringBootApplication
@EnableTurbine
@EnableEurekaClient
@EnableHystrixDashboard
@Slf4j
public class TurbineDashboardApp {

    public static void main(String[] args) {
        log.info(">>> 启动 TurbineDashboardApp server 开始 <<<");
        SpringApplication.run(TurbineDashboardApp.class, args);
        log.info(">>> 启动 TurbineDashboardApp server 结束<<<");
    }

    /**
     *
     * @TODO:springcloud2.x 各个微服务的hystrix.stream端点没有，需要手工添加
     *
    @Bean
    public ServletRegistrationBean getHystrixMetricsStreamServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/actuator/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }
    **/
}
